import base64url from "base64url"

let handleParam = {
  'defaultParam': '?x-oss-process=image',
  'compress_pn': '/quality,Q_' ,
  'compress_p70': '/quality,Q_70',
  'compress_p60': '/quality,Q_60',
  'previewImg': '/resize,',
  'resize_p20': '/resize,P_20',
  'resize_1920': '/resize,w_1920,h_1080',
  'watermarkPrefix': '/watermark,image_',
  'watermarkParam': ',t_100,g_se,x_25,y_40',
  'watermarkOrigin': ',t_100,g_se,x_100,y_150'
}

// 水印图片 http://sucai.suoluomei.cn/sucai_zs/images/20180416/9381d581ce60c1be55cbdc1b6649be71.png?x-oss-process=image/resize,p_20,limit_0
let waterMarkOrg = 'http://sucai.suoluomei.cn/sucai_zs/images/20181201/bc785107cb1007cc17daece84b480b07.png'
// let waterMarkOrg = 'http://cn-weipingtai.oss-cn-shenzhen.aliyuncs.com/huodong/image/20180726/1532599919697.png'
let waterMarkUrl = waterMarkOrg.split(/\.(cn|com)\//)[2] + handleParam.defaultParam + handleParam.resize_p20

let watermark = handleParam.watermarkPrefix + base64url(waterMarkUrl)

const smallWaterMark = handleParam.defaultParam + watermark + handleParam.watermarkOrigin

let ossCompressHasWaterMark = handleParam.defaultParam + handleParam.resize_1920 + handleParam.compress_p70 + watermark
let ossCompressNoWaterMark = handleParam.defaultParam + handleParam.resize_1920 + handleParam.compress_p70
// 文字水印
let text = '禾葡兰'
ossCompressHasWaterMark = handleParam.defaultParam + handleParam.resize_1920 + handleParam.compress_p70 + '/watermark,text_' + base64url(text) + ',rotate_45,color_ffffff,shadow_50,fill_1,t_10' + watermark
export default {
  WATERMARK: smallWaterMark,
  ossCompressHasWaterMark,
  ossCompressNoWaterMark
}